package com.mymvc.controller.retval;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * ClassName: OrderController
 * Package: com.mymvc.controller.retval
 * Description:
 *
 * @Author 刘英杰
 * @Create 2025/2/8 17:26
 * @Version 1.0
 */

@Controller
@RequestMapping("/order")
public class OrderController {
    @RequestMapping("/list.do")
    public void list(HttpServletResponse response, HttpServletRequest request) throws ServletException, IOException {
        request.setAttribute("list","数据");
        request.getRequestDispatcher("/WEB-INF/jsp/orderList.jsp").forward(request,response);
    }

    @RequestMapping("/update.do")
    public void update(HttpServletResponse response, HttpServletRequest request) throws ServletException, IOException {
        System.out.println("更新完成");
        response.sendRedirect(request.getContextPath()+"/order/list.do");
    }

    @RequestMapping("/list02")
    public String list02() {
        return "orderList";
    }

    @RequestMapping("/update02")
    public String update02(){
        System.out.println("更新完成");
        return "forward:list.do";
    }

    @RequestMapping("/update03")
    public String update03(){
        System.out.println("更新完成");
        return "redirect:list.do";
    }


}
